//
//  YDYMainViewController.m
//  DY_Bilibili
//
//  Created by 杨德勇 on 2016/9/20.
//  Copyright © 2016年 杨德勇. All rights reserved.
//

#import "YDYMainViewController.h"
#import "YDYOldHomeViewController.h"
#import "YDYMainTabBar.h"
#import "YDYNavigationController.h"
#import "YDYMineController.h"
@interface YDYMainViewController ()
/** 工具栏名字 */
@property (nonatomic, strong) NSArray *toolbarNames;

@end

@implementation YDYMainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setValue:[[YDYMainTabBar alloc]init] forKey:@"tabBar"];
    
    [self setupControllers];
//    [self setupToolBar];
    
   
    
   }
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
//    [self setupControllers];
//    [self reloadInputViews];
}
-(void)setupControllers{
//    UIViewController *con = [[UIViewController alloc]init];
////    con.view.frame = CGRectMake(0, 0, 100, 100);
//    con.view.backgroundColor = [UIColor blueColor];
//    con.tabBarItem.title = @"aaa";
//   [self addChildViewController:con];
//    YDYLog(@"%@",self.childViewControllers);
    
}
//-(void)setupToolBar{
//    
//    UIView *toolbar = [[UIView alloc]initWithFrame:CGRectMake(0, YDYScreenSize.height -44, YDYScreenSize.width, 44)];
//    toolbar.backgroundColor = [UIColor blackColor];
//    
//       for (int i = 0; i<5 ; i++) {
//        UIButton *btn = [UIButton ydy_BtnWithImageName:self.toolbarNames[i]];
//
//        
//        CGFloat btnW = YDYScreenSize.width / 5.0;
//        CGFloat btnH = 44.0;
//        btn.frame = CGRectMake(i * btnW, 0, btnW, btnH);
//        btn.tag = i + 1;
//        [btn addTarget:self action:@selector(toolbarClick:) forControlEvents:UIControlEventTouchUpInside];
//        [toolbar addSubview:btn];
//    }
//
//    [self.view addSubview:toolbar];
//    
//}
-(void)toolbarClick:(UIButton *)button{
    button.highlighted = !button.highlighted;
    [self performSegueWithIdentifier:@"home" sender:nil];
    YDYLog(@"%ld",button.tag);
    
    
}
-(void)viewDidAppear:(BOOL)animated{
    

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
   
}

#pragma mark -
#pragma mark -lazy loading  
-(NSArray *)toolbarNames{
    if (_toolbarNames.count == 0) {
        _toolbarNames = @[@"home_home_tab",@"home_category_tab",@"home_attention_tab",@"home_discovery_tab",@"home_mine_tab"];
        
    }
    return _toolbarNames;
}

@end
